import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
import 'package:tencent_kit/tencent_kit.dart';

import 'package:ball_lion/utils/constant.dart';

class ThirdLoginService extends GetxService {
  Future<ThirdLoginService> init() async {
    return this;
  }

  initThird() async {
    await TencentKitPlatform.instance.setIsPermissionGranted(granted: true);
    // await TencentKitPlatform.instance.registerApp(appId: Constant.txAppId);
    // await WeiboKitPlatform.instance.registerApp(
    //     appKey: Constant.wbAppKey,
    //     universalLink: 'https://www.qiuxiangbiao.cn/app/',
    //     scope: <String>[WeiboScope.ALL]);
  }

  onWechatLogin() {
    Fluwx().authBy(which: NormalAuth(scope: "snsapi_userinfo", state: "auth"));
  }

  onQQLogin() {
    TencentKitPlatform.instance.login(
      scope: <String>[TencentScope.kGetSimpleUserInfo],
    );
  }

  // onWeiboLogin() {
  //   WeiboKitPlatform.instance.auth(appKey: Constant.wbAppKey, scope: <String>[
  //     WeiboScope.ALL,
  //   ]);
  // }

  // Future<AuthorizationCredentialAppleID> onAppleLogin() async {
  //   final credential = await SignInWithApple.getAppleIDCredential(
  //     scopes: [
  //       AppleIDAuthorizationScopes.email,
  //       AppleIDAuthorizationScopes.fullName,
  //     ],
  //   );
  //   return credential;
  // }
}
